% This script compile KMC as a mex function and can be used in 